package com.example.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entity.AfshopUserCoupon;
import com.example.demo.mapper.AfshopUserCouponMapper;
import com.example.demo.service.IAfshopUserCouponService;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/*
 * @Author:大力王
 * @Date:2024/6/25-25-18:08
 * 开始了
 */
public class AfshopUserCouponServiceImpl extends ServiceImpl<AfshopUserCouponMapper, AfshopUserCoupon> implements IAfshopUserCouponService {
    @Resource
    private AfshopUserCouponMapper afshopUserCouponMapper;
    @Override
    public AfshopUserCoupon queryObject(Integer id) {
        return afshopUserCouponMapper.queryObject(id);
    }

    @Override
    public AfshopUserCoupon queryByCouponNumber(String couponNumber) {
        return afshopUserCouponMapper.queryByCouponNumber(couponNumber);
    }

    @Override
    public List<AfshopUserCoupon> queryList(Map<String, Object> map) {
        return afshopUserCouponMapper.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return afshopUserCouponMapper.queryTotal(map);
    }

    @Override
    public boolean save(AfshopUserCoupon goods) {
        afshopUserCouponMapper.insert(goods);
        return false;
    }


    public void update(AfshopUserCoupon goods) {
        QueryWrapper<AfshopUserCoupon> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", goods.getId());
        afshopUserCouponMapper.update(queryWrapper);
    }


    public void delete(Integer id) {
        QueryWrapper<AfshopUserCoupon> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", id);
        afshopUserCouponMapper.delete(queryWrapper);
    }


    public void deleteBatch(Integer[] ids) {
        QueryWrapper<AfshopUserCoupon> queryWrapper = new QueryWrapper<>();
        queryWrapper.in("id", (Object) ids);
        afshopUserCouponMapper.delete(queryWrapper);
    }
}
